package com.hxz.graduationdesign.base.response;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@Setter
@Getter
@AllArgsConstructor
public class JsonResult {

    private Integer code;
    private String msg;
    private Object data=null;

    public JsonResult(StatusCode statusCode, Object date) {
        this.code=statusCode.getCode();
        this.msg=statusCode.getMsg();
        this.data = date;
    }

    public JsonResult(StatusCode statusCode) {
        this.code=statusCode.getCode();
        this.msg=statusCode.getMsg();
    }

    public static JsonResult ok(Object data){
        return new JsonResult(StatusCode.OPERATION_SUCCESS,data);
    }

}
